<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../css/public.css">
</head>

<body>
    <!-- font  设置或返回文本内容的当前字体属性 -->
    <!-- fillText() 在画布上绘制“被填充的”文本-->
    
    <canvas id="myCanvas1" width="300" height="150" style="border:1px solid #d3d3d3;"></canvas>

    <script>
        var a = document.getElementById('myCanvas1');
        var atx = a.getContext('2d');
        atx.font="40px Arial";
        atx.fillText("Hello World",10,50);
    </script>
</body>

</html>